using UnityEngine;

public class PlayerInput : MonoBehaviour
{
	private bool canInput => true;
	public Vector2 MoveValue => moveValue;
    public bool IsInputJump => canInput &&  Input.GetKeyDown(KeyCode.Space);
    public bool IsInputMove => moveValue != Vector2.zero;
	public bool IsInputRun => canInput &&  Input.GetKey(KeyCode.LeftShift);
	public bool IsInputPick => canInput &&  Input.GetKeyDown(KeyCode.G);
	public bool IsInputReload => canInput &&  Input.GetKeyDown(KeyCode.R);
	public bool IsPressFire => canInput &&  Input.GetMouseButton(0);
	public bool IsEndFire => canInput &&  Input.GetMouseButtonUp(0);
	public bool IsPressAim => canInput &&  Input.GetMouseButton(1);
	public bool IsEndAim => canInput &&  Input.GetMouseButtonUp(1);
	public float MouseX => Input.GetAxis("Mouse X") * mouseXSensitivity;
	public float MouseY => Input.GetAxis("Mouse Y") * mouseYSensitivity;
    [SerializeField] private float mouseXSensitivity = 50f;
    [SerializeField] private float mouseYSensitivity = 25f;
	[SerializeField] private bool isLockCursor;
	private Vector2 moveValue => new Vector2 (Input.GetAxisRaw("Horizontal") ,Input.GetAxisRaw("Vertical"));
	private void Awake()
	{
		if(isLockCursor)
		{
			Cursor.lockState = CursorLockMode.Locked;
			Cursor.visible = false;
		}
		else
		{
			Cursor.visible = true;
			Cursor.lockState = CursorLockMode.None;
		}
	}
}
